package chaoyue.study.reflect;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

/**
 * 通过反射机制，尝试反编译一个类的属性Filed
 * IDEA的反编译好像就是这么做的
 */
public class Test06 {
    public static void main(String[] args) throws Exception {
        Class clazz = Class.forName("chaoyue.study.reflect.bean.Student");
        System.out.println(Modifier.toString(clazz.getModifiers()) + " class " + clazz.getSimpleName() + " {");
        for (Field field : clazz.getDeclaredFields()) {
            System.out.println("\t" + Modifier.toString(field.getModifiers()) + " " + field.getType().getSimpleName() + " " + field.getName() + ";");
        }
        System.out.println("}");
    }
}
